<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>思想教育登记</title>
<link href="${request.contextPath}/static/css/layout.css" rel="stylesheet" type="text/css" />
<link href="${request.contextPath}/static/css/cb.css" rel="stylesheet" type="text/css" />
<link href="${request.contextPath}/static/css/n.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="${request.contextPath}/static/easyui/themes/default/easyui.css" />
<link rel="stylesheet" type="text/css" href="${request.contextPath}/static/easyui/themes/icon.css" />
<link rel="stylesheet" type="text/css" href="${request.contextPath}/static/easyui/demo/demo1.css" />
<script type="text/javascript" src="${request.contextPath}/static/easyui/jquery.min.js"></script>
<script type="text/javascript" src="${request.contextPath}/static/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="${request.contextPath}/static/laydate/laydate.js"></script>
<script type="text/javascript" src="${request.contextPath}/static/js/laypage/laypage.js"></script>
<script src="${request.contextPath}/static/js/vue/vue.min.js" charset="utf-8"></script>
</head>
<body>
	<table width="99%" border="0" align="center" cellpadding="0" cellspacing="1">
		<tr>
			<td width="1%" align="left" background="${request.contextPath}/static/images/b2.jpg"><img src="${request.contextPath}/static/images/b1.jpg" width="10" height="26" /></td>
			<td width="68%" background="${request.contextPath}/static/images/b2.jpg">
			<table width="140" border="0" align="left" cellpadding="0" cellspacing="1">
			  <tr>
				 <td width="20" align="left"><img src="${request.contextPath}/static/images/tz.gif" width="10" height="16" /></td>
				 <td width="112" align="left" class="biao">查找思想教育登记</td>
			 </tr>
			</table>
		   </td>
			<td width="31%" align="right" background="${request.contextPath}/static/images/b2.jpg"><img src="${request.contextPath}/static/images/b3.jpg" width="9" height="26" /></td>
		</tr>
	</table>
	<table width="99%" border="0" align="center" cellpadding="3"
		cellspacing="1" bgcolor="#AEDEF4">
		<tr>
			<td align="center" bgcolor="#E2F7FE">
				<form id="form1" name="form1" method="post" action="">
					<table width="80%" border="0" cellspacing="1" cellpadding="3">
						<tr>
							<td width="10%" align="right">姓名:</td>
							<td width="10%" align="left">
							<input name="name" type="text" id="pdName" size="15" /></td>
							<td width="10%" align="right">矫正日期:</td>
							<td width="10%" align="left">
							<input placeholder="请输入日期"  class="laydate-icon" onclick="laydate()" id="likedate"/></td>
							<td width="10%" align="left"><input type="button"
								name="button" onclick="getLikeThoughts()" value="查找"/></td>
							<td width="10%" colspan="2" align="right">
							<input type="button" onclick="addEvent()" name="" value="增加记录" /> 
							<input type="button" onclick="outExcel()" name="" value="导出Excel"/></td>
						</tr>
					</table>
				</form>
			</td>
		</tr>
	</table>
	<table width="50%" border="0" cellspacing="1" cellpadding="0">
		<tr>
			<td height="5"></td>
		</tr>
	</table>
	<table width="99%" border="0" align="center" cellpadding="0"
		cellspacing="1">
		<tr>
			<td width="1%" align="left" background="${request.contextPath}/static/images/b2.jpg"><img src="${request.contextPath}/static/images/b1.jpg" width="10" height="26" /></td>
			<td width="68%" background="${request.contextPath}/static/images/b2.jpg">
				<table width="140" border="0" align="left" cellpadding="0" cellspacing="1">
					<tr>
						<td width="20" align="left"><img src="${request.contextPath}/static/images/tz.gif" width="10" height="16" /></td>
						<td width="112" align="left" class="biao">思想教育登记列表</td>
					</tr>
				</table>
			</td>
			<td width="31%" align="right" background="${request.contextPath}/static/images/b2.jpg"><img
				src="${request.contextPath}/static/images/b3.jpg" width="9" height="26" /></td>
		</tr>
	</table>
	<table width="99%" border="0" align="center" cellpadding="3"
		cellspacing="1" bgcolor="#AEDEF4" style="border: 1px solid #AEDEF4" id="ap">
		<tr>
			<td width="5%" height="25" align="center" bgcolor="#EFFBFE">选项</td>
			<td align="center" bgcolor="#EFFBFE">矫正单位</td>
			<td align="center" bgcolor="#EFFBFE">姓名</td>
			<td align="center" bgcolor="#EFFBFE">学习日期</td>
			<td align="center" bgcolor="#EFFBFE">教育方式</td>
			<td align="center" bgcolor="#EFFBFE">表现情况</td>
			<td align="center" bgcolor="#EFFBFE">分值</td>
			<td align="center" bgcolor="#EFFBFE">得分</td>
			<td align="center" bgcolor="#EFFBFE">操作</td>
		</tr>
		<tr onmouseout="this.style.backgroundColor='#ffffff'" bgcolor="#ffffff" onmouseover="this.style.backgroundColor='#E6F2FF'" v-for="(item,index) in result">
			<td height="25" align="center"><input name="id[]" value="" type="checkbox"  /></td>
			<td align="center" class="t5">
				<div align="center"><strong>{{item.jdName}}</strong></div>
			</td>
			<td align="center">{{item.pdName}}</td>
			<td align="center">{{item.date}}</td>
			<td align="center">{{item.type}}</td>
			<td align="center">{{item.performance}}</td>
			<td align="center">{{item.basiscore}}</td>
			<td align="center">{{item.score}}</td>
			<td align="left">
				<div align="left" style="padding-left: 5px">
					<div align="center">
						<input type="button" @click="editEvent(item.id)" name="" value="修改" />
						<input type="button" @click="delEvent(item.id)" name="" value="删除" />
					</div>
				</div>
			</td>
		</tr>
		<tr>
			<td colspan="6" align="center">
				<div id="pagediv"></div>
			</td>
		</tr>
	</table>
	<!-- 增加矫正方案弹出框 -->
	<div id="dlag"></div>
	<!-- 修改矫正方案弹出框 -->
	<div id="dlag2"></div>
<script type="text/javascript">

  //查询所有列表遍历的数组result[]
  var ap = new Vue({
	  el : '#ap',
	  data : {
		 result : []
	  }
 });
  //监听添加事件
	var addEvent = function() {
		$('#dlag').dialog({
			title : '思想教育登记',
			width : '800px',
			height : '480px',
			padding : '10px',
			closed : false,
			region : 'center',
			cache : false,
			href : '${request.contextPath}/thought/addView',
			modal : true,
			iconCls : 'icon-save',
			buttons : [ {
				text : '保存',
				iconCls : 'icon-ok',
				handler : function() {
					addThought();
					$('#dlag').dialog('close');
					getLikeThoughts();
				}
			}, {
				text : '关闭',
				handler : function() {
					$('#dlag').dialog('close');
				}
			} ]
		});
	}
   
	//添加矫正方案
	var addThought = function() {
		$.ajax({
			type:'post',
			data : $('#form3').serialize(),//根据"name属性"序列化
			dateType : "json",
			url : "${request.contextPath}/thought/add",
			success : function(result) {
				showMsg(result.message);
				
			}
		})
	}
 
	//弹出框
	function showMsg(msg) {
		$.messager.show({
			title : '我的消息',
			msg : msg,
			timeout : 5000,
			showType : 'slide'
		});
	}
   
	//修改矫正方案
	var editThought=function(id){
		$.ajax({
			type:'POST',
			data : $('#form4').serialize(),
			url : '${request.contextPath}/thought/edit',
	        success : function(result){
	        showMsg(result.message);
	        
	      }
	})
}	
	//监听修改事件
	var editEvent = function(id) {
		$('#dlag2').dialog({
			title : '思想教育登记',
			width : '800px',
			height : '480px',
			padding : '10px',
			closed : false,
			region : 'center',
			cache : false,
		    href: '${request.contextPath}/thought/get?id='+id, //传参数id;
			modal : true,
			iconCls : 'icon-save',
			buttons : [ {
				text : '保存',
				iconCls : 'icon-ok',
				handler : function() {
					editThought();
					$('#dlag2').dialog('close');
					getLikeThoughts();
				}
			}, {
				text : '关闭',
				handler : function() {
					$('#dlag2').dialog('close');
				}
			} ]
		});
	}
	  //删除监听事件
	   var delEvent = function(id) {
		   $.extend($.messager.defaults,{
               ok:"确定",
               cancel:"取消"
            });
				$.messager.confirm('提示框', '你确定要删除吗?',function(res){
					if(res){
						delThought(id);
						getLikeThoughts();
					}else{
					//取消删除
					}
				})
			}
	 //删除矫正方案列表
		var delThought= function(id){
			$.ajax({
				type : "POST",
				url : '${request.contextPath}/thought/del',
				dataType : "json",
				data : {
					id:id
			  },
			success:function(result){
				showMsg(result.message);	
		    }	
		})
		
	 }
		//模糊查询矫正方案列表
		var getLikeThoughts=function(curr){
			$.ajax({
				 type : "Get",
				 url:"${request.contextPath}/thought/getLike",
				 dateType:"json",
				 data:{
					pageNum : curr || 1,
				    pageSize : 3,
					name:$("#pdName").val(),
		            date:$("#likedate").val(), 
				 },
				 success:function(result){
					ap.result=result.data[0].result;
					laypage({
						cont : 'pagediv', //容器。值支持id名、原生dom对象，jquery对象,
						pages : result.data[0].totalPage, //总页数
						first : "首页",
						last : "尾页",
						skip : true, //是否开启跳页
						skin : '#5675A2',
						curr : curr || 1, //当前页
						jump : function(obj, first) { //触发分页后的回调
							if (!first) { //点击跳页触发函数自身，并传递当前页：obj.curr
								getLikeThoughts(obj.curr);
							}
						}
	               });
			}
		})
	};
	//模糊查询
	getLikeThoughts();
	//导出Excel		
	function outExcel(){
     var url = "${request.contextPath}/thought/excel";
     window.open(url);
 }
</script>
</body>
</html>
